<?php
/**
 * mysql记录日志
 * 注:access_log不建议用mysql来做，可能会严重影响
 * mysql的性能。
 * @author: yanxs <541139655@qq.com>
 * @version: 1.0
 * @date: 2019/8/22
 */

namespace App\Services\Common\Log;


use Illuminate\Support\Facades\DB;

class Mysql implements LogInterface
{
    protected $table;
    public function setCollection($collection)
    {
        // TODO: Implement setCollection() method.
        $this->table = $collection;
    }
    public function record($data)
    {
        // TODO: Implement record() method.
        $connection = DB::connection("mysql")->table($this->table);
        $connection->insert(['data' => json_encode($data)]);
    }
}
